package shop.core;

import shop.core.common.bean.FrontContainer;
import shop.core.common.bean.ManageContainer;
import shop.services.manage.system.bean.User;
import shop.services.front.account.bean.Account;

import javax.servlet.http.HttpSession;

/**
 * 获取当前登陆用户信息，直到页面关闭才释放
 * Created by jeeshopfans
 */
public class LoginUserHolder {
    //后台管理者用户信息
    public static User getLoginUser(){
        HttpSession session = RequestHolder.getSession();
        return session == null ? null : (User)session.getAttribute(ManageContainer.manage_session_user_info);
    }
    //志愿者或者机构的信息
    public static Account getLoginAccount(){
        HttpSession session = RequestHolder.getSession();
        return session == null ? null : (Account)session.getAttribute(FrontContainer.USER_INFO);
    }
}
